***************************************************************************************************
*Do-file to analyse INVEDUC data: April 2022
 * Replication file for the paper: Fiscal policy preference, trade-offs, and support for social investment
 * Authors: Björn Bremer (bremer@mpifg.de), Marius Busemeyer (marius.busemeyer@uni-konstanz.de)
 * Please see the readme.txt file for more information.
***************************************************************************************************

***************************************************************************************************

** load the INVEDUC data, which can be downloaded here: https://doi.org/10.4232/1.13140
*use ".../ZA6961_v1-0-0.dta", replace

set more off
set scheme plotplainblind
set showbaselevels on
svyset [pweight=GEW_ALL]
ssc install coefplot, replace
net describe polychoric, from(http://staskolenikov.net/stata)
net install polychoric

***************************************************************************************************
*** code from the official "ZA6961_Master_coding.do" file to recode some variables
***************************************************************************************************
*country (string variable; alphabetically)
gen country="DE" if COUNTRYCODE==13
replace country="DK" if COUNTRYCODE==31
replace country="ES" if COUNTRYCODE==16
replace country="FR" if COUNTRYCODE==51
replace country="IE" if COUNTRYCODE==35
replace country="IT" if COUNTRYCODE==15
replace country="SE" if COUNTRYCODE==18
replace country="UK" if COUNTRYCODE==25

*generate common education level variable
gen educlevel=.
replace educlevel=Q641 if COUNTRYCODE==13 /*Germany*/
replace educlevel=Q642 if COUNTRYCODE==31 /*Denmark*/
replace educlevel=Q643 if COUNTRYCODE==25 /*UK*/
replace educlevel=Q644 if COUNTRYCODE==15 /*Italy*/
replace educlevel=Q645 if COUNTRYCODE==18 /*Sweden*/
replace educlevel=Q646 if COUNTRYCODE==35 /*Ireland*/
replace educlevel=Q647 if COUNTRYCODE==16 /*Spain*/
replace educlevel=Q648 if COUNTRYCODE==51 /*France*/
replace educlevel=. if educlevel>6

*household income (quintiles)
recode Q74 8=. 9=.
rename Q74 hhincome

*age
recode Q11 9999=.
gen age=2014-Q11

*retired
gen oldage=.
replace oldage=1 if age>=65
replace oldage=0 if age<=64

*respondent´s current situation
gen currentsit=Q6602
recode currentsit (.=6) (98=.) (99=.)
replace currentsit=7 if Q6602==6 & Q6601>=2 & Q6601<=3
replace currentsit=8 if Q67>=2 & Q67<=4
label values currentsit Q6602
label define Q6602 6 "working full time" 7 "work. part-time, volunt." 8 "work. part-time, involunt.", modify

*respondent´s current situation: alternative coding: less fine-grained categories
gen currentsitv3=currentsit
recode currentsitv3 (4=96)(5=96)(7=96)(8=96)
label values currentsitv3 Q6602

*current situation: separate dummies (to allow interactions)
gen currentsitv3_1_ue=currentsitv3
gen currentsitv3_2_stud=currentsitv3
gen currentsitv3_3_ret=currentsitv3
gen currentsitv3_6_work=currentsitv3
gen currentsitv3_9_oth=currentsitv3
recode currentsitv3_1_ue (1=1)(2=0)(3=0)(6=0)(96=0) 
recode currentsitv3_2_stud (1=0)(2=1)(3=0)(6=0)(96=0)  
recode currentsitv3_3_ret (1=0)(2=0)(3=1)(6=0)(96=0)  
recode currentsitv3_6_work (1=0)(2=0)(3=0)(6=1)(96=0)  
recode currentsitv3_9_oth (1=0)(2=0)(3=0)(6=0)(96=1)  
label var currentsitv3_1_ue "unempl."
label var currentsitv3_2_stud "student"
label var currentsitv3_3_ret "retired"
label var currentsitv3_6_work "working"
label var currentsitv3_9_oth "other"

*gender
gen female=.
replace female=1 if Q12==2
replace female=0 if Q12==1

*how many young children
recode Q79 9=.
gen nrsmallkids=Q79
replace nrsmallkids=0 if Q78==0
replace nrsmallkids=0 if Q77==1

*small kids dummy
gen smallkids_dummy=.
replace smallkids_dummy=1 if nrsmallkids>=1
replace smallkids_dummy=0 if nrsmallkids==0
replace smallkids_dummy=. if nrsmallkids==.

*left-right placement
gen lire=Q55
recode lire (99=.)
label values lire Q55

*Q14, Gal-Tan and economic left-right
foreach var of varlist Q14_1 Q14_2 Q14_3 Q14_4 Q14_5 Q18_1 Q18_2 Q18_3 Q18_4 Q18_5 Q18_6 {
recode `var' (8 9=.)
gen `var'rec=`var' 
recode `var'rec (1=5)(2=4)(3=3)(4=2)(5=1)
}
*

*Two-dimensional ideological positions: social values and economic left-right: create factor score variables
polychoric Q14_1rec Q14_2rec Q14_3rec Q14_4rec Q14_5rec
display r(sum_w)
global N = r(sum_w)
matrix r = r(R)
factormat r, n($N) pcf
rotate
predict galtan econlr
replace econlr=econlr*-1
label var galtan "Social values (right)"
label var econlr "Economic left-right (right)"

*union membership
gen unionmemb=Q81
recode unionmemb (2=0) (9=.)

*public sector employment
gen publsector=Q70
recode publsector (2 .=0) (8=.) (9=.)

***Recode missings
 *including political & social trust; education satisfaction (Q17, Q13, Q33)
recode Q19 Q23_* Q26_* Q27 Q33 Q13 (8=.) (9=.)
recode Q25 Q17 (98=.) (99=.)

*Recode variables: higher values indicate preferences for more spending, satisfaction, ...
foreach var of varlist Q19 Q23_1-Q23_9 Q26_1-Q26_4 Q33 Q13 { 
gen `var'_rec = `var'
recode `var'_rec (5=1)(4=2)(2=4)(1=5)
} 
label define spending_inv 1"spend much less"2"spend less"3"spend the same as now"4"spend more"5"spend much more"
label values Q19_rec Q23_1_rec Q23_2_rec Q23_3_rec Q23_4_rec Q23_5_rec Q23_6_rec Q23_7_rec Q23_8_rec Q23_9_rec Q26_1_rec Q26_2_rec Q26_3_rec Q26_4_rec spending_inv
gen genspend=Q19_rec
label values genspend spending_inv

***************************************************************************************************
*** re-label variables for regression analysis
***************************************************************************************************

*label drop Q70
*label drop yesno

lab var educlevel "Education level"
lab var hhincome "Household income"
lab var oldage "Retired"
lab var currentsitv3_1_ue "Unemployed"
lab var currentsitv3_2_stud "Student"
lab var age "Age"
lab var female "Female"
lab var smallkids_dummy "Small children"
lab var galtan "Social values (right)"
label var econlr "Economic left-right (right)"
lab var unionmemb "Union member"
lab var publsector "Public sector"
label var COUNTRYCODE "Country"
label var lire "Left-right position"

***************************************************************************************************
*** recode variables
***************************************************************************************************

*--Q13, government performance
gen govperf=Q13
recode govperf (8=.) (9=.)
recode govperf (1=5) (2=4) (4=2) (5=1)
label values govperf Q13

lab var govperf "Government performance"

*--Q51-54, spending trade-offs
recode Q51 (1=1)(2=1)(3 4 5 6 7 8=0) (9=.), gen(Q51_dum)
recode Q52 (1=1)(2=1)(3 4 5 6 7 8=0) (9=.), gen(Q52_dum)
recode Q53 (1=1)(2=1)(3 4 5 6 7 8=0) (9=.), gen(Q53_dum)
recode Q54 (1=1)(2=1)(3 4 5 6 7 8=0) (9=.), gen(Q54_dum)

label var Q51_dum "Educ vs. unemployment"
label var Q52_dum "Educ vs. pensions"
label var Q53_dum "Familes vs. unemployment"
label var Q54_dum "Familes vs. pensions"

***************************************************************************************************
*** create fiscal types for people based on their attitudes towards social spending (Q20+Q21)
***************************************************************************************************

** 5 fiscal types: 
*1) public spending enthusiasts: expansion
*2) welfare state fans: recalibration, more social spending
*3) status quo lovers: no change
*4) welfare state critics: recalibration, less social spending
*5) public spending sceptics: decrease 

gen sp_type =. 
replace sp_type = 1 if Q20_1 == 1 | Q20_2 == 1
replace sp_type = 2 if Q20_3 == 1
replace sp_type = 3 if Q19_rec == 3 
replace sp_type = 4 if Q21_1 == 1 | Q21_2 == 1
replace sp_type = 5 if Q21_3 == 1

*note: people who don't know how to increase/decrease spending are coded as "no change"

label define sp_type 1 "Public spending enthusiasts" 2 "Welfare state fans" 3 "Status quo lovers" 4 "Welfare state critics" 5 "Public spending sceptics" 
label values sp_type sp_type
label var sp_type "Fiscal type"

***************************************************************************************************
*** figure 1: plot distribution of the different spending types (histograms)
***************************************************************************************************

format sp_type %9.2g
histogram sp_type, barw(0.95) xlabel(1/5, valuelabel labsize(vsmall) alt) xtitle("") ytitle("Share") discrete addlabels addlabopts(yvarformat(%9.2f))
graph export figure1.eps, replace

***************************************************************************************************
*** table 3: analyse spending types as dv (multinominal logit)
***************************************************************************************************

eststo clear 
eststo: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, base(3) cluster(COUNTRYCODE)
eststo: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, base(3) cluster (COUNTRYCODE)
esttab using table3.html, scalars(r2_p aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Predicting fiscal types by different socio-economic characteristics and attitudes) ///
alignment(D{.}{.}{-1})

***************************************************************************************************
*** figure 2: plot distribution of the different spending trade-off (histograms)
***************************************************************************************************

gen tradeoff_combined = .
replace tradeoff_combined = Q51_dum if Q51_dum != .
replace tradeoff_combined = Q52_dum if Q52_dum != .
replace tradeoff_combined = Q53_dum if Q53_dum != .
replace tradeoff_combined = Q54_dum if Q54_dum != .

gen tradeoff_number = .
replace tradeoff_number = 1 if Q51_dum != .
replace tradeoff_number = 2 if Q52_dum != .
replace tradeoff_number = 3 if Q53_dum != .
replace tradeoff_number = 4 if Q54_dum != .

label define tradeoff_number 1 "Educ. vs. unemployment" 2 "Educ. vs. pensions" 3 "Families vs. unemployment" 4 "Families vs. pensions"
label values tradeoff_number tradeoff_number
label var tradeoff_number "Split"

egen share = mean(tradeoff_combined), by(tradeoff_number)
egen total = total(1), by(tradeoff_combined)

format share %9.2g
twoway bar share tradeoff_number, barw(0.95) fcolor(white) || scatter share tradeoff_number, mlabel(share) mlabpos(12) legend(off) ytitle("Share") xtitle("") xlabel(1/4, valuelabel labsize(vsmall) angle(45))
graph export figure2.eps, replace

***************************************************************************************************
*** table 4: analyse influence of spending types on trade-offs (binominal logit)
***************************************************************************************************

eststo clear 
eststo: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
esttab using table4.html, scalars(r2_p aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Predicting support for social policy trade-offs by fiscal type) ///
alignment(D{.}{.}{-1})

***************************************************************************************************
*** figure 3: plot marginal effects based on table 4
***************************************************************************************************

logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE) 
margins, dydx(ib3.sp_type) post 
estimates store Q51

logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
margins, dydx(ib3.sp_type) post
estimates store Q52

logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
margins, dydx(ib3.sp_type) post
estimates store Q53

logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
margins, dydx(ib3.sp_type) post
estimates store Q54

coefplot (Q51, label("Educ. vs. unemployment")) (Q52, label("Educ. vs. pensions")) (Q53, label("Families vs. unemployment")) (Q54, label("Families vs. pensions")), ///
xline(0) title("") xtitle("") ytitle("") keep(*:) omitted baselevels
graph export figure3.eps, replace

***************************************************************************************************
*** appendix
***************************************************************************************************

** table a.1: summary statistics
eststo clear
estpost summarize sp_type Q51_dum Q52_dum Q53_dum Q54_dum educlevel hhincome oldage currentsitv3_1_ue currentsitv3_2_stud age female smallkids_dummy unionmemb lire govperf
esttab using tableA1.html, cells("mean sd min max count") replace

** table a.2: balance of respondentts across treatment groups
eststo clear
sort tradeoff_number
by tradeoff_number: eststo: quietly estpost summarize sp_type educlevel hhincome oldage currentsitv3_1_ue currentsitv3_2_stud age female smallkids_dummy unionmemb lire govperf
esttab using tableA2.html, cells("mean sd") replace

** figure a.2: distribution of fiscal types by country
twoway histogram sp_type, barw(0.95) xlabel(1/5, valuelabel labsize(vsmall) angle(45))  xtitle("") ytitle("Share") discrete by(country, graphregion(margin(2 2 2 2)) rows(2)) 
graph export figureA2.eps, replace

** figure a.3: support for trade-offs across the four different scenarios by country
egen share_country = mean(tradeoff_combined), by(tradeoff_number country)
egen total_country = total(1), by(tradeoff_combined)

format share_country %9.2g 
twoway bar share_country tradeoff_number, barw(0.95) fcolor(white) legend(off) ytitle("Share") xtitle("") xlabel(1/4, valuelabel labsize(vsmall) angle(45)) by(country, graphregion(margin(2 2 2 2)) rows(2))
graph export figureA3.eps, replace

** table a.3: replication table 4 with ols regressions 
recode Q51 (8 9=.), gen(Q51_ord)
recode Q52 (8 9=.), gen(Q52_ord)
recode Q53 (8 9=.), gen(Q53_ord)
recode Q54 (8 9=.), gen(Q54_ord)

label var Q51_ord "Educ vs. unemployment"
label var Q52_ord "Educ vs. pensions"
label var Q53_ord "Familes vs. unemployment"
label var Q54_ord "Familes vs. pensions"

eststo clear 
eststo: quietly reg Q51_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q52_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q53_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q54_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q51_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q52_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q53_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly reg Q54_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
esttab using tableA3.html, r2 ar2 aic bic nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Attitudes towards social policy trade-offs by fiscal type) ///
alignment(D{.}{.}{-1})

** table a.4: replication table 4 with ordered logistic regression
eststo clear 
eststo: quietly ologit Q51_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q52_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q53_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q54_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q51_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q52_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q53_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
eststo: quietly ologit Q54_ord ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, cluster(COUNTRYCODE)
esttab using tableA4.html, pr2 aic bic nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Attitudes towards social policy trade-offs by fiscal type) ///
alignment(D{.}{.}{-1})

** table a.5: replication table 3 with survey weights 
eststo clear 
eststo: svy: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE, base(3)
eststo: svy: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE, base(3)
esttab using tableA5.html, scalars(pr2 aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Predicting fiscal types by different socio-economic characteristics and attitudes) ///
alignment(D{.}{.}{-1})

** table a.6: replication table 4 with survey weights
eststo clear 
eststo: svy: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE
eststo: svy: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE
eststo: svy: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE
eststo: svy: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb i.COUNTRYCODE
eststo: svy: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE
eststo: svy: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE
eststo: svy: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE
eststo: svy: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf i.COUNTRYCODE
esttab using tableA6.html, scalars(pr2 aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) drop (*.COUNTRYCODE) ///
title(Attitudes towards social policy trade-offs by fiscal type) ///
alignment(D{.}{.}{-1})

** table a.7: replicating table 3 with a jackknife resampling approach 
eststo clear 
eststo: jacknife: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb, base(3) cluster(COUNTRYCODE)
eststo: jacknife: quietly mlogit sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf, base(3) cluster (COUNTRYCODE)
esttab using tableA7.html, scalars(r2_p aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) ///
title(Predicting fiscal types by different socio-economic characteristics and attitudes) ///
alignment(D{.}{.}{-1})

** table a.8: replicating table 4 with a jackknife resampling approach
eststo clear 
eststo: jacknife: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q51_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q52_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q53_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf, cluster(COUNTRYCODE)
eststo: jacknife: quietly logit Q54_dum ib3.sp_type educlevel hhincome i.oldage i.currentsitv3_1_ue i.currentsitv3_2_stud age i.female i.smallkids_dummy i.unionmemb lire govperf, cluster(COUNTRYCODE)

esttab using tableA8.html, scalars(r2_p aic bic) nogaps nobaselevels unstack noomitted label replace ///
starlevels(* 0.05 ** 0.01 *** 0.001) ///
title(Attitudes towards social policy trade-offs by fiscal type (Jackknife approach)) ///
alignment(D{.}{.}{-1})